package cn.kgc.controller;

import cn.kgc.pojo.Pojo_hxy;
import cn.kgc.service.impl.ServiceImpl_hxy;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
public class Controller_hxy {

    @Resource
    private ServiceImpl_hxy serviceImpl_hxy;

    @RequestMapping("/面试管理")
    public String mianShi() {
        return "面试管理";
    }

    @ResponseBody
    @RequestMapping("/showMianShi")
    public String showMianShi(@RequestParam String name, @RequestParam String experience,
                              @RequestParam String status, @RequestParam String positionName,
                              @RequestParam String rTime, @RequestParam Integer currentPage, @RequestParam Integer pageSize){
        PageHelper.startPage(currentPage,pageSize);
        Page<Pojo_hxy> list = serviceImpl_hxy.selAllResumes(name,positionName,experience,status,rTime);
        PageInfo<Pojo_hxy> pageInfo = new PageInfo<Pojo_hxy>(list);

        return JSON.toJSONString(pageInfo);
    }


    @RequestMapping("/录用管理")
    public String luYong() {

        return "录用管理";
    }

    @GetMapping("/面试结果登记/{rId}")
    public String mianShiDengJi(@PathVariable String rId, Model model) {

        Pojo_hxy po = serviceImpl_hxy.selResumeById(Integer.valueOf(rId));
        model.addAttribute("info",po);
        return "面试结果登记";
    }

    @RequestMapping("/录用结果登记/{rId}")
    public String luYongDengJi(@PathVariable String rId, Model model) {

        Pojo_hxy po = serviceImpl_hxy.selResumeById(Integer.valueOf(rId));
        model.addAttribute("info",po);
        return "录用结果登记";
    }

}
